$linkColor: #069;

/* highlight plugin. */
/* @import "highlight-googlecode.css"; */
@import "prism-tomorrow.css";

/* reset cnzz. */
a[href*='www.cnzz.com']{
  display: none;
}

/* prism style. */
pre.line-numbers{

  font-size: .8rem;
  position: relative;
  padding-left: 3.8em;
  counter-reset: linenumber;

  > code {
    position: relative;
  }
  .line-numbers-rows {
  	position: absolute;
  	pointer-events: none;
  	top: 0;
  	font-size: 100%;
  	left: -3.8em;
  	width: 3em; /* works for line-numbers below 1000 lines */
  	letter-spacing: -1px;
  	border-right: 1px solid #999;
  	user-select: none;

    > span {
  		pointer-events: none;
  		display: block;
  		counter-increment: linenumber;
      &:before {
  			content: counter(linenumber);
  			color: #999;
  			display: block;
  			padding-right: 0.8em;
  			text-align: right;
  		}
  	}
  }
}

/* reset duoshuo. */
#ds-thread #ds-reset li.ds-tab a,
#ds-reset .ds-gradient-bg,
#ds-thread #ds-reset .ds-post-button,
.ds-like-thread-button{
  background: #fff !important;
}
#ds-thread #ds-reset li.ds-tab a,
#ds-reset .ds-avatar,
#ds-reset .ds-avatar img,
#ds-reset .ds-rounded-top,
#ds-post-toolbar,
#ds-thread #ds-reset .ds-post-options,
#ds-thread #ds-reset .ds-post-button,
.ds-like-thread-button{
  border-radius: 0 !important;
}
#ds-notify{
  @media (max-width:411px){
    display: none !important;
  }
}
.comment-box .comment-loading{
  color: #666;
}

/* website. */
html {
  font-size: 16px;
  height: 100%;
}
body {
  background: #EDE8D5 top right no-repeat;
  box-sizing: border-box;
  min-height: 100%;
  margin: 0;
  padding: 0;
  color: #222;
  font-family: Helvetica, Arial, sans-serif, Tahoma, \5B8B\4F53;
  line-height: 1.62;
  -webkit-font-smoothing:antialiased;
  padding: 2rem 2rem 2rem 14rem;
  position: relative;

  &.page-home{
    background-size: 300px auto;
    background-image: url(../images/home-background/01.jpg);
  }

  > svg{ display: none; }
  @media (max-width: 1024px){
    padding-left: 5rem;
    padding-bottom: 0;
    .navigation{
      a{
        margin: 0;
        padding: .4rem 0;
        text-align: center;
      }
      svg{
        margin: 0;
        height: 1.4rem;
        width: 1.4rem;
      }
    }
    .sidebar{
      width: 3rem;
      > header{
        h2{ display: none; }
      }
      > footer{
        display: none;
      }
    }
  }
  @media (max-width: 414px){
    &.page-home{
      background-position: 0 88px;
      background-size: cover;
    }
    .navigation{
      display: none;
      &:after{
        content: "";
        clear: both;
        display: table;
      }
      a{
        float: left;
        font-size: .8rem;
        margin: 0 0 0 .4rem;
        padding: .6rem;
        line-height: normal;
      }
      svg{
        margin-right: .2rem;
      }
    }
    .sidebar{
      height: auto;
      width: 100%;
      > header{
        .mylogo{
          max-width: 7rem;
          img:first-child{ display: block; }
          img:last-child{ display: none; }
        }
        h2{ display: block; }
      }
    }
  }
  @media (max-width: 414px){
    padding: 7rem 1rem 1rem;
  }
}
a{ color: $linkColor; text-decoration: none; }
p, dl, dt, dd, pre, blockquote{ margin: 0; padding: 0; }
ul, ol, li{ margin: 0; padding: 0; list-style:none; }
h1, h2, h3, h4, h5, h6{
  font-size: 100%;
  font-weight: normal;
  margin: 0;
}
em{ font-style: normal; }
img{ border: none; }
code{
  background-color: #eee;
  display: inline-block;
  vertical-align: middle;
  padding: 0 .4rem;
}
blockquote{
  display: block;
}

svg.icon{
  fill: #333;
  display: inline-block;
  vertical-align: middle;
  height: 1em;
  width: 1em;
}

.highlight{
  background-color: #f5f2e9;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  th, td{
    padding: 0;
  }
  .gutter{
    border-right: 2px solid #e0dcca;
    color: #a6a395;
    text-align: right;
    padding-right: .5rem;
  }
  .code{
    padding-left: .5rem;
  }
  pre{
    font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
    font-size: 14px;
  }
}

@define-placeholder clearfix::after{
  content: "";
  clear: both;
  display: table;
}

.donate-qrcode{
  border: solid #ddd;
  border-width: 1px 0;
  padding: 1rem 0;
  margin: 2rem 0;
  max-width: 640px;
  h3{
    font-size: 1.1rem;
  }
  ul{
    margin: 1rem 0;
    &::after{
      content: "";
      clear: both;
      display: table;
    }
    li{
      box-sizing: border-box;
      float: left;
      width: 50%;
      &:first-child{ padding-right: .5rem; }
      &:last-child{ padding-left: .5rem; }
    }
  }
  img{
    max-width: 100%;
    vertical-align: top;
  }
}

.gallery{
  background-color: #f1f1f1;
  position: relative;
  overflow: hidden;
}

.container{
  max-width: 700px;
  margin: 0 auto;
}

.navigation{
  $text-color: #564b47;
  background-color: hsl(22, 30%, 60%);
  margin: 1rem 0;
  padding-bottom: .6rem;
  position: relative;
  z-index: 1;
  a{
    background-color: rgba(255,255,255,.17);
    box-sizing: border-box;
    color: #fff;
    display: block;
    padding: .6rem 1rem .6rem 0;
    margin: .6rem 0 .6rem .6rem;
    text-align: right;
    transition:margin-left .4s;
    em{
      display: inline-block;
      vertical-align: middle;
    }
  }
  svg{
    fill: #fff;
    margin-right: .4rem;
    height: 1.2rem;
    width: 1.2rem;
    transition: transform .4s;
  }
  a:hover,
  a.now{
    background-color: #EDE8D5;
    color: $text-color;
    svg{
      fill: $text-color;
      transform: rotate(360deg);
    }
  }
  a.now{
    cursor: default;
  }
}

.mobile-navigation{
  display: none;
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  overflow: hidden;
  > button{
    backface-visibility: hidden;
    background: none;
    border: none;
    display: block;
    width: 1.8rem;
    outline: none;
    padding: 0;
  	span, &::before, &::after{
  		background-color: #fff;
      content: "";
      display: block;
  		overflow: hidden;
  		height: 2px;
  	}
  	span{
  		text-indent: -9em;
      margin: .6rem 0;
  	}
  }

  /*
  select{
    border: none;
    outline: none;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    font-size: 1.2rem;
  }
  */
  @media (max-width: 414px){
    display: block;
  }
}

.sidebar{
  background-color: hsl(22, 30%, 60%);
  box-sizing: border-box;
  color: #fff;
  position: fixed;
  left: 0;
  top: 0;
  height: 100%;
  width: 12rem;
  z-index: 100;

  > header{
    margin: 1rem .8rem;
    .mylogo{
      color: #fff;
      display: block;
      font-size: 1.8rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-bottom: .5rem;
      line-height: normal;
      img{
        max-width: 100%;
        vertical-align: top;
      }
      img:last-child{ display: none; }
    }
    h2{
      font-size: .8rem;
    }
    @media (max-width:1024px){
      margin: 1rem .5rem;
      .mylogo{
        img:first-child{ display: none; }
        img:last-child{ display: block; }
      }
    }
  }
  > footer{
    color: rgba(255,255,255,.45);
    position: absolute;
    bottom: .8rem;

    left: 0;
    padding: 0 .8rem;
    line-height: 1.8;
    p{
      font-size:.8rem;
    }
    a{
      color: #fff;
    }
    .icon{
      fill: #fff;
      margin-right: .2rem;
    }
  }
}

.gallery{
  a{
    display: block;
  }
  img{
    display: inline-block;
    vertical-align: top;
    max-width: 100%;
  }
}

.video-container{
  > iframe{
    max-width: 100%;
  }
}

.breadcrumbs{
  border-bottom: 1px solid #b9b9b9;
  padding-bottom: .5rem;
  margin-bottom: 2rem;
  ul, li{
    display: inline;
  }
  > .icon{
    fill: #666;
    vertical-align: -.1rem;
  }
  li::after{
    content: " >";
    color: #ccc;
  }
  li:last-child{
    font-weight: bold;
    cursor: default;
    &::after{
      display: none;
    }
  }
  a{
    color: #333;
  }
  a:hover{
    text-decoration: underline;
  }
}

body > footer{
  color: #999;
  text-align: center;
  margin-top: 2rem;
  a{ color: #666; }
}

.articles{
  .article{
    border-bottom: 1px dashed #b9b9b9;
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    &:last-child{
      border-bottom: none;
      padding-bottom: 0;
      margin-bottom: 0;
    }
    a{
      color: #333;
    }
    .body{
      margin-top: 1rem;
    }
    > header h1{
      font-size: 1.4rem;
      line-height: 1.5;
      > a{
        background-color: #534d4b;
        border-left: 0 solid #534d4b;
        color: #f9f6ec;
        display: block;
        padding: .2rem .5rem;
        transition: background-color .4s, border-left-width .2s;
        &:hover{
          background-color: #8c8481;
          border-left-width: 3px;
        }
      }
    }
    > footer{
      margin-top: 1rem;
      text-align: right;
      font-size: .8rem;
      &::after{
        content: "";
        clear: both;
        display: table;
      }
      .date{
        float: left;
        time{
          display: inline-block;
          vertical-align: middle;
        }
      }
      .more-link{
        border: 1px solid #534d4b;
        color: #534d4b;
        float: right;
        padding: .2rem .6rem;
        line-height: normal;
        transition: border-color .4s, color .4s;
        &:hover{
          border-color: $linkColor;
          color: $linkColor;
          svg{ fill: $linkColor; }
        }
        svg{
          display: inline-block;
          vertical-align: middle;
          height: 1.2em;
          width: 1.2em;
          transition: fill .4s;
        }
        em{
          display: inline-block;
          vertical-align: middle;
        }
      }
    }
  }
}

.article{
  header{
    margin-bottom: .5rem;
    h1{
      font-size: 2rem;
      font-weight: bold;
      line-height: 1.2;
    }
  }
  .body{
    background-color: #FAF7ED;
    color: #2f2f2f;
    font-family: "Xin Gothic", "PT Sans", "Hiragino Sans GB", "Helvetica Neue", Helvetica, Arial, Sans-serif;
    margin-top: 2rem;
    padding: 1rem 2rem;
    h1, h2, h3, h4, h5, h6, p, blockquote, figure{
      margin: 1rem 0;
    }
    h1, h2, h3, h4, h5, h6{
      margin-top: 2em;
    }
    h1{
      font-size: 2rem;
    }
    h2{
      font-size: 1.8rem;
    }
    h3{
      background-color: #8c8481;
      border-bottom: 3px solid #534d4b;
      color: #f9f6ec;
      font-size: 1.2rem;
      padding: .6rem 1rem;
      line-height: normal;
    }
    h4{
      font-size: 1.4rem;
    }
    h5{
      font-size: 1.2rem;
    }
    h6{
      font-size: 1rem;
    }
    a{
      word-wrap: break-word;
      &:hover{
        text-decoration: underline;
      }
    }
    img{
      vertical-align: top;
      max-width: 100%;
    }
    > ol > li,
    > ul > li{
      margin-bottom: 1rem;
      &:last-child{ margin-bottom: 0; }
    }
    > ol{
      padding-left: 1rem;
      > li {
        list-style: decimal inside;

      }
    }
    > ul{
      padding-left: 1rem;
      > li {
        list-style: disc inside;
      }
    }
    > table{
      border-collapse: collapse;
      th, td{
        border: 1px solid #ddd;
        padding: .4rem .6rem;
      }
      td{
        font-size: .9rem;
      }
    }
    hr{
      border: dashed #ccc;
      border-width: 1px 0 0;
      margin: 3rem 0;
    }
    dd{
      margin-left: 1rem;
    }
    del{
      color: #999;
    }
    blockquote{
      background-color: rgba(0,0,0,.05);
      border-left: .5rem solid rgba(0,0,0,.17);
      padding: 1rem;
      p:first-child{ margin-top: 0; }
      p:last-child{ margin-bottom: 0; }
      code{
        background-color: rgba(0,0,0,.07);
        margin: 0 .2rem;
      }
    }
  }
  .meta{
    margin: 0 0 1rem;
    .date, .category, .tag-list{
      color: #666;
      display: inline-block;
      vertical-align: middle;
      margin-right: .4rem;
      white-space: nowrap;
    }
    .date{
      svg, time{
        display: inline-block;
        vertical-align: middle;
      }
      time{
        font-size: .8rem;
      }
      svg{
        height: .8rem;
        width: .8rem;
        fill: #666;
      }
    }
    .category{
      a{
        background-color: #8c8481;
        border: 1px solid #8c8481;
        color: #fff;
        display: inline-block;
        vertical-align: middle;
        position: relative;
        font-size: .85rem;
        line-height: 1rem;
        padding: 0 1rem 0 1rem;
        &:before{
          background-color: #8c8481;
          border: solid #fff;
          border-width: 1px 1px 0 0;
          content: "";
          position: absolute;
          right: -.5rem;
          top: .2rem;
          height: .6rem;
          width: .6rem;
          transform: rotate(45deg);
          z-index: 1;
        }
        &:last-child{
          background-color: #fff;
          color: #444;
          &:before{
            display: none;
          }
        }
      }
    }
    .tag-list{
      padding-right: .4rem;
      li{
        display: inline-block;
        margin-right: .8rem;
        &:last-child{ margin-right: 0; }
      }
      a{
        background-color: #8c8481;
        color: #fff;
        display: inline-block;
        padding: 0 .6rem;
        position: relative;
        font-size: .85rem;
        line-height: 1rem;
        white-space: nowrap;
        &:before{
          content: "";
          position: absolute;
          right: -.5rem;
          top: 0;
          border: .5rem solid rgba(255,255,255,0);
          border-right-width: 0;
          border-left-color: #8c8481;
        }
        &:after{
          background-color: rgba(255,255,255,.85);
          content: "";
          border-radius: 50%;
          height: .25rem;
          width: .25rem;
          position: absolute;
          right: -.2rem;
          top: 50%;
          margin-top: -.16rem;
        }
      }
    }
  }
  .more-link{
    transition: color .4s;
    &:hover{ color: $linkColor; }
  }
  > footer{
    margin-top: 4rem;
  }
  #more{
    border-bottom: 1px solid #ccc;
    display: block;
  }
}

.paging{
  margin-top: 3rem;
  text-align: center;
  span{
    border: 1px solid #534d4b;
    color: #534d4b;
  }
  span, a{
    display: inline-block;
    vertical-align: middle;
    padding: .5rem 1rem;
    margin: 0 .2rem;
    font-size: 1.2rem;
    line-height: normal;
  }
  a{
    border: 1px solid $linkColor;
    color: $linkColor;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .4s, border-color .4s, color .4s;
    &:hover{
      background-color: $linkColor;
      color: #fff;
    }
  }
}

.archives{
  .year{
    font-size: 1.6rem;
    a{
      color: #333;
    }
  }
  > ul{
    border-left: 1px dashed #ddd;
    margin-left: 1rem;
    padding: .5rem .5rem .5rem 1rem;
    li{
      margin-bottom: 1rem;
      position: relative;
      &:last-child{
        margin-bottom: 0;
      }
    }
    h1{
      margin-left: 80px;
    }
    .date{
      color: #333;
      position: absolute;
      left: 0;
      top: 0;
    }
    .title{
      color: #333;
      display: inline-block;
      vertical-align: top;
      font-size: 1.2rem;
    }
  }
}

.retop{
  $color: #911b1b;
	background-color:rgba(255,255,255,.17);
	bottom:1rem;
  cursor: pointer;
  display: none;
	font-size:1.8rem;
	line-height:36px;
	position:fixed;
	right:1rem;
	text-align:center;
	width:36px;
	z-index:101;
	transition:background-color .4s, bottom .8s .4s ease-in, color .4s;
  .icon{
    fill: #333;
    transition: fill .4s;
  }
  &:hover .icon{
    fill: $color;
  }
	&:after{
		background-image:linear-gradient(#ff3131, rgba(255,255,255,0));
		border-radius:4px;
		content:"";
		height:10px;
		left:50%;
		margin-left:-2px;
		opacity:0;
		position:absolute;
		top:27px;
		transition:opacity .4s, height .8s .4s;
		width:4px;
	}
	&.actived{
		background-color:rgba(0,0,0,0);
		bottom:124%;
		&.actived:after{
			height:100px;
			opacity:1;
		}
    .icon{
      fill: $color;
    }
	}
}

.article-nav{
  margin: 2rem 0;
  &::after{
    content: "";
    display: table;
    clear: both;
  }
  a{
    color: #333;
    width: 50%;
    position: relative;
    &::after{
      border: 1px solid $linkColor;
      box-sizing: border-box;
      color: $linkColor;
      padding: .35rem .6rem;
      position: absolute;
      top: 0;
      transition: background-color .4s, color .4s;
    }
    &:hover{
      em{
        opacity: 1;
      }
      &::after{
        background-color: $linkColor;
        color: #fff;
      }
    }
  }
  em{
    background-color: #fff;
    box-sizing: border-box;
    padding: .4rem .6rem;
    display: block;
    opacity: .37;
    transition: opacity .4s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 1px;
  }
  .newer{
    float: left;
    em{
      margin-left: 2rem;
    }
    &::after{
      content: "<";
      left: 0;
    }
  }
  .older{
    float: right;
    em{
      margin-right: 2rem;
    }
    &::after{
      content: ">";
      right: 0;
    }
  }
}

.mobile-nav{
  right: .5rem;
  left: .5rem;
  bottom: -100%;
  display: none;
  transition: bottom .4s;
  position: fixed;
  z-index: 102;
  &.actived{
    bottom: .5rem;
  }
  li{
    border-bottom: 1px solid #fff;
    &.now{
      a{
        background-color: rgba(184,145,122,.37);
        color: #222;
      }
      svg{
        fill: #222;
      }
    }
  }
  li:last-child{
    border-bottom: none;
  }
  a{
    background-color: hsl(22, 30%, 60%);
    color: #fff;
    display: block;
    padding: .8rem 1.2rem;
    text-align: center;
    line-height: normal;
  }
  svg, em{
    display: inline-block;
    vertical-align: middle;
  }
  svg{
    fill: #fff;
  }
  @media (max-width: 414px){
    display: block;
  }
}

.shade{
  background-color: rgba(255,255,255,.85);
  display: none;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  position: fixed;
  z-index: 101;
  &.actived{
    display: block;
  }
}

.welcome{
  padding-right: 300px;
  text-align: center;
  p{
    line-height: 1.8;
    margin: .4rem 0;
  }
  hr{
    border: none;
    border-bottom: 1px solid #aaa;
    display: block;
    width: auto;
    margin: 0;
  }
  .my-portrait{
    vertical-align: top;
    height: 80px;
    margin-bottom: 1rem;
  }
  @media (max-width: 414px) {
    background-color: rgba(255,255,255,.85);
    padding: 2rem 1rem;
    hr{ display: none; }
  }
}
